<php>$meta_title = "缺货订单";</php>
<include file="Public:header" />
<tagLib name="html" />
<div id="main" class="main" >
<!-- 主体内容  -->
<div class="content" >
<!--  功能组区域  -->
<div class="btn-toolbar">
	<div class="btn-group">
		<button class="btn btn-primary" onclick="pick_goods()"> <i class="icon-shopping-cart  icon-white"></i>拣货单</button>
		<button class="btn btn-primary" onclick="invoice()"> <i class="icon-tags  icon-white"></i>配货单</button>
		<button class="btn btn-primary" onclick="shipping()"> <i class="icon-download-alt  icon-white"></i>快递单</button>
		<button class="btn btn-primary" onclick="doshipping()"> <i class="icon-forward  icon-white"></i>发货</button>
		<button class="btn btn-primary" onclick="mass_doshipping()"> <i class="icon-plane  icon-white"></i>闪电发货</button>
	</div>
		导出
		<a href="__APP__/ToShipping/export_order?{$parameters}&etype=order&action=outstock" class="btn">订单</a>
		<a href="__APP__/ToShipping/export_order?{$parameters}&etype=detail&action=outstock" class="btn">商品</a>
		<a href="__APP__/ToShipping/export_order?{$parameters}&etype=both&action=outstock" class="btn">全部</a>
		<span class="label label-important">总数量:{$sum_overview.number}  发件票数:{$sum_overview.sum_logino}</span>
	<form class="search-form" method='get' action="__URL__">
		运单<input type="text" class="search-query span2" name="logino" <notempty name='_REQUEST.logino'>
		<php>echo 'value="'.urldecode($_REQUEST['logino']).'"'</php>
		<else/>
		placeholder="运单号" </notempty> >
	   收货人<input type="text" class="search-query span2" name="shipping_name" <notempty name='_REQUEST.shipping_name'>
		<php>echo 'value="'.urldecode($_REQUEST['shipping_name']).'"'</php>
		<else/>
		placeholder="收货人" </notempty> >

	   手机<input type="text" class="search-query span2" name="mobile" <notempty name='_REQUEST.mobile'>
		<php>echo 'value="'.urldecode($_REQUEST['mobile']).'"'</php>
		<else/>
		placeholder="手机" </notempty> >


		订单号<input type="text" class="search-query span2" name="order_no" <notempty name='_REQUEST.order_no'>
		<php>echo 'value="'.urldecode($_REQUEST['order_no']).'"'</php>
		<else/>
		placeholder="按订单号搜索"
	</notempty>
	>
	<!--Advaced Search-->
     <div  id="searchM" class=" none search cBoth" >
         每页显示 <input type="text" class="span1" name="listRows" value="{$_REQUEST.listRows}">
         
	   买家<input type="text" class="search-query span2" name="customer_name" <notempty name='_REQUEST.customer_name'>
		<php>echo 'value="'.urldecode($_REQUEST['customer_name']).'"'</php>
		<else/>
		placeholder="买家" </notempty> >
		 快递{:modList('Logicompany',$_REQUEST['logicompany_id'],'span2','logicompany_id','sort desc' )}
         <!--<select name="status" class="span1"> 
			<option value="">--审核状态--</option>
			<option value="1" <eq name="_REQUEST.status" value="1">selected</eq> >审核通过</option> 
			<option value="0" <eq name="_REQUEST.status" value="0">selected</eq> >待审核</option> 
		</select> -->
		订单状态{:configList( C('orderStatus'),$_REQUEST['order_status'],'order_status' )}
		来源{:modList( 'Order_source',$_REQUEST['order_source_id'],'span1', 'order_source_id' )}
		产品<input type="text" class="search-query span2" name="keywords" <notempty name='_REQUEST.keywords'>
		<php>echo 'value="'.urldecode($_REQUEST['keywords']).'"'</php>
		<else/>
		placeholder="产品"
	</notempty> >
		<select name="time_type" class="span2"> 
			<option value="">--选择时间类型--</option>
			<option value="1" <eq name="_REQUEST.time_type" value="1">selected</eq> >审核时间</option> 
			<option value="2" <eq name="_REQUEST.time_type" value="2">selected</eq> >发货时间</option> 
			<option value="3" <eq name="_REQUEST.time_type" value="3">selected</eq> >下单时间</option> 
			<option value="4" <eq name="_REQUEST.time_type" value="4">selected</eq> >支付时间</option>
		</select>
		从<input type="text" class="span2"  name="start_time" onClick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" value="<notempty name='_REQUEST.start_time'>{$_REQUEST.start_time}</notempty>">
		到<input type="text" class="span2" onClick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" name="end_time" id="end_time" value="<notempty name='_REQUEST.end_time'>{$_REQUEST.end_time}</notempty>" >

     </div>
	<input type="submit" class="btn btn-primary" value="搜索">
    <a class="btn btn-info" onclick="showHideSearch()" href="javascript:void(0)" ><i class="icon-chevron-down icon-white"></i> 更多</a>
	</form>
	
</div>
<!-- 功能组区域结束 -->
<php>
    function editLink($id){
     echo ('<a href="__URL__/edit/id/'.$id.'">'.getModelName($id,"Sale","sale_no").'</a>');
	}
    function out_stock_log($id){
      echo ('<a href="__URL__/out_stock_log/id/'.$id.'" class="btn btn-primary" target="_blank">缺货登记</a>');    
    
    }
</php>
<!-- 列表显示区域  -->
<div class="list" >
<div id="result" class="result none"></div><html:list id="checkList" pk="id" action="true" style="table table-bordered table-striped table-striped" checkbox="true"  datasource="list" show="id:编号|3%:edit,id|editLink:订单号|4%,mall_no|word_wrap:原单号,product_id|getModelName=Product:产品,number:数量,shipping_name:收货人,logicompany_id|getModelName='Logicompany':快递,logino:快递单号,prepare_status|getConfigVal=prepare_status:配货状态,order_status|getConfigVal=orderstatus:订单状态,remark|cutstr=50:备注|10%,sctime|toDate:下单时间,check_time|toDate:审核时间,order_source_id|getModelName='Order_source':订单来源" actionlist="edit:详情:id"/>
</div>
<!--  分页显示区域 -->
<div class="page">{$page}</div>
<!-- 列表显示区域结束 -->
</div>
<!-- 主体内容结束 -->
</div>
<include file="Public:footer"/>
<load href="__PUBLIC__/Js/My97DatePicker/WdatePicker.js" />
<script type="text/javascript">

  //填写快递单号，TODO置为发货状态
  function doshipping(id){
  var keyValue = (id)? id : getSelectCheckboxValues();
	if (keyValue=='')
	{
		alert('请选择订单！');
		return false;
	}
    window.open( APP+"/ToShipping/doshipping/oid/"+keyValue, '_blank' );
  }

//批量填写快递单号，TODO置为发货状态
  function mass_doshipping(id){
  var keyValue = (id)? id : getSelectCheckboxValues();
	if (keyValue=='')
	{
		alert('请选择订单！');
		return false;
	}
    window.open( APP+"/ToShipping/mass_doshipping/oid/"+keyValue, '_blank' );
  }


 function invoice(id){
 	var keyValue = (id)? id : getSelectCheckboxValues();
	if (keyValue=='')
	{
		alert('请选择订单！');
		return false;
	}
        window.open(APP+"/ToShipping/invoice/oid/"+keyValue,'_blank' );
 }
 function shipping(id){
 	var keyValue = (id)? id : getSelectCheckboxValues();
	if (keyValue=='')
	{
		alert('请选择订单！');
		return false;
	}
        location.href = APP+"/ToShipping/shipping/oid/"+keyValue;
 }
 function pick_goods(id){
 	var keyValue = (id)? id : getSelectCheckboxValues();
	if (keyValue=='')
	{
		alert('请选择订单！');
		return false;
	}
        window.open( APP+"/ToShipping/pick_goods/oid/"+keyValue , '_blank' );
 }
</script>
